package com.heima.wemedia.feign;

import com.heima.client.wemedia.IWemediaClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.dtos.WmUserDto;
import com.heima.wemedia.service.WmAutoScanService;
import com.heima.wemedia.service.WmUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 */
@RestController
@Slf4j
public class WemediaClient implements IWemediaClient {
    @Autowired
    private WmAutoScanService wmAutoScanService;
    @PostMapping("/api/v1/comment/sync")
    public ResponseResult autoScan(@RequestBody String text){
        log.info("article评论审核开始了：{}....",text);
        boolean isPass = wmAutoScanService.autoScanComment(text);
        return ResponseResult.okResult(isPass);
    }

    @Autowired
    private WmUserService wmUserService;

    /**
     * 新增自媒体端用户信息
     */
    @PostMapping("/wm_user/add")
    public ResponseResult add(@RequestBody WmUserDto dto) {
        log.info("接受到的参数为{}", dto);
        return wmUserService.add(dto);
    }
}
